/*
 * @Author: your name
 * @Date: 2021-06-26 09:52:28
 * @LastEditTime: 2021-06-26 10:04:16
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \6.26作业\yyds\model\model.js
 */
class Moel{
    constructor(data,message){
        if(typeof data ==="string"){
            this.message=data
        }else{
            if(data) this.data=data
            if(message) this.message=message
        }
    }
}

class SuccessModel extends Model{
    constructor(data,message){
        super(data,message)
        this.code=1
    }
}


class ErrorModel extends Model{
    constructor(message){
        super(message)
        this.code=-1
    }
}

function success(data,message){
    return new SuccessModel(message,data)
}

function error(message){
    return new ErrorModel(message)
}

export default {
    success,
    error,
}